use "C:\Users\marp2228\OneDrive - USherbrooke\USherbrooke\Abortion and Postpartum Depression\JAMA Submission\PPD_meta-regression dataset.dta", clear

meta set ppd_prev lci_prev hci_prev, random studylabel(countrylbl) studysize(total_sample) civartolerance(1e-1)

meta forestplot

***

gen gini_wb_10 = gini_wb/10 /*a 10-unit change in income inequality */

gen gdp_dev = gdp_pc/25000 /*a 25,000 US dollars change in GDP per capita */

gen ln_infantm = ln(infant_mortality) /*log of infant mortality*/

gen ln_maternalm= ln(maternal_death_risk) /*log of maternal death risk*/

gen ln_lbw= ln(low_birth_wgt_infants) /*log of low birth weight infants*/
 
***

qnorm gini_wb_10, mlabel(country)
qnorm gdp_dev, mlabel(country)
qnorm women_work, mlabel(country)
qnorm unpaid_leave, mlabel(country)
qnorm paid_leave, mlabel(country)
qnorm ln_infantm, mlabel(country)
qnorm ln_maternalm, mlabel(country)
qnorm fertility_rate, mlabel(country)
qnorm ln_lbw, mlabel(country)
qnorm cesarean, mlabel(country)
qnorm single_parent_child, mlabel(country)
qnorm births_outside_marriage, mlabel(country)
qnorm urbanized_pop
qnorm abortion_law
qnorm lastyear_ipv
qnorm gender_inequality_rank

** ECONOMIC (1) **

meta regress gini_wb_10
meta regress gdp_dev 
meta regress women_work
meta regress unpaid_leave
meta regress paid_leave

** ECONOMIC (2) **

regress ppd_prev gini_wb_10 gdp_dev women_work
estat vif
regress ppd_prev gini_wb_10 women_work
estat vif
meta regress gini_wb_10 women_work

* // *

bma ppd_prev, auxiliary(gini_wb_10 women_work)

meta regress gini_wb_10
predict double u, reffects se(se_u)
gen double ustandard = u/se_u
qnorm ustandard, mlabel(countrylbl)
drop u se_u ustandard

meta regress gini_wb_10 if countrylbl!="Chile"

** ECONOMIC = GINI **

** HEALTH (1) **

meta regress fertility_rate
meta regress fertility_rate if countrylbl!="Nigeria"
meta regress ln_infantm
meta regress ln_maternalm
meta regress ln_maternalm if countrylbl!="Nigeria"
meta regress ln_lbw
meta regress cesarean

** HEALTH (2) **

regress ppd_prev ln_infantm ln_maternalm
estat vif
meta regress ln_infantm ln_maternalm

* // *

bma ppd_prev, auxiliary(ln_infantm ln_maternalm)

meta regress ln_infantm
predict double u, reffects se(se_u)
gen double ustandard = u/se_u
qnorm ustandard, mlabel(countrylbl)
drop u se_u ustandard

meta regress ln_infantm if countrylbl!="Chile"

** HEALTH = INFANT MORTALITY **

** DEMOGRAPHIC (1) **

meta regress single_parent_child
meta regress births_outside_marriage
meta regress urbanized_pop

** DEMOGRAPHIC = NULL **

** GENDER (1) **

meta regress abortion_law
meta regress lastyear_ipv
meta regress lastyear_ipv if countrylbl!="Bangladesh" & countrylbl!="India"
meta regress gender_inequality_rank

** GENDER (2) **

regress ppd_prev abortion_law lastyear_ipv gender_inequality_rank
estat vif
regress ppd_prev abortion_law lastyear_ipv
estat vif
meta regress abortion_law lastyear_ipv
meta regress abortion_law

* // *

bma ppd_prev, auxiliary(abortion_law lastyear_ipv)

meta regress abortion_law
predict double u, reffects se(se_u)
gen double ustandard = u/se_u
qnorm ustandard, mlabel(countrylbl)
drop u se_u ustandard

** GENDER = ABORTION LAW **

** OVERALL = ECONOMIC, HEALTH, GENDER **

regress ppd_prev gini_wb_10 ln_infantm abortion_law
estat vif
meta regress gini_wb_10 ln_infantm abortion_law
meta regress gini_wb_10 abortion_law

* // *
bma ppd_prev, auxiliary(gini_wb_10 ln_infantm abortion_law)

meta regress gini_wb_10 abortion_law
predict double u, reffects se(se_u)
gen double ustandard = u/se_u
qnorm ustandard, mlabel(countrylbl)
drop u se_u ustandard

meta regress gini_wb
estat bubbleplot, legend(off) xtitle("Income inequality") ytitle("National-level PPD symptom prevalence") title("") graphregion(color(white) fcolor(white)) 

meta regress abortion_law
estat bubbleplot, legend(off) xtitle("Abortion policies") ytitle("National-level PPD symptom prevalence") title("") graphregion(color(white) fcolor(white))

